/**
 * 
 */
package com.oron3.bouncer.objects;

import com.oron3.bouncer.genericgl.GLWorld;
import com.oron3.bouncer.genericgl.MatrixTrackingGL;
import com.oron3.bouncer.objects.shapes.Point;
import com.oron3.bouncer.objects.shapes.Vector;

/**
 * @author Ofek
 *
 */
public class GLRay extends GLLine implements GLShape {
	private float t;

	/**
	 * @param p1
	 * @param p2
	 */
	public GLRay(final Point p1, final Point p2) {
		super(p1, p2);

	}
	@Override
	public void step(final float dt,final GLWorld glWorld) {	
		t+=10*dt;
	}
	/* (non-Javadoc)
	 * @see com.oron3.bouncer.genericgl.Line#draw(javax.microedition.khronos.opengles.GL10)
	 */
	/* (non-Javadoc)
	 * @see com.oron3.bouncer.genericgl.Line#draw(com.oron3.bouncer.genericgl.MatrixTrackingGL)
	 */
	@Override
	public void draw(final MatrixTrackingGL gl) {
		final Vector d = line.d;
		gl.glTranslatef(d.x*t, d.y*t, d.z*t);
		super.draw(gl);
		gl.glTranslatef(-d.x*t, -d.y*t, -d.z*t);
		gl.glTranslatef(-d.x*t, -d.y*t, -d.z*t);
		super.draw(gl);
		gl.glTranslatef(d.x*t, d.y*t, d.z*t);
	}
}
